#ifndef PGROUP_H
#define PGROUP_H

#include <utility>
#include "group.h"
typedef pair<int,int> _ipair;

class pgroup
{
private:
	bool _debug;						// debug mode switcher
public:
	vector<vec3> r;						// vector of atom positions;
	unsigned int npair;					// number of group pairs
	vector<real> ccc;					// attraction coefficient
	vector<real> ddd;					// repulsion coefficient
	vector<real> rc;					// cut-off radius for each pair
	vector<real> rlist;					// rc+1.0 in ususal case
	unsigned int isx, isy, isz;			// linked cell numbers
	unsigned int iside, iside2, iside4;	// useful parameters
	real rxsize, rysize, rzsize;		// useful parameters
	real rcell;							// used to generate linked cell

	vector< vector<_ipair> > vlist;		// verlet list
	vector<_ipair> label;				// pair of linked cells
	unsigned int nlist;					// length of verlet list
	unsigned int nbox, nlabel;			// number of linked cells, length of label
	vector< vector<int> > ibox;			// list of atom id's for each cell
	
	pgroup(vector<vec3> R);
	pgroup(vector<vec3> R, real rcell0);	// constructor
	void initialize0();					// initialize parameters
	void initialize();					// initialize members, should be called after p being established
	int pair_id(int d1, int d2);		// return the id of the group pair
	void labels();						// set up label, called in initialize()
	void verlet();						// set up or update verlet list
	void eval();						// evaluate forces

	void debug();						// debug mode
};


#endif
